package com.taiyuan.zfmvp.kafka.controller;

import com.alibaba.fastjson.JSON;
import com.taiyuan.zfmvp.kafka.service.ProducerService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @param request
 * @Author: zhoufang@si-tech.com.cn
 * @Descriiption:
 * @Date 2022/2/14
 * @return
 */


@RestController
@RequestMapping("/kafka")
public class KafkaTestController {

    @Resource
    private ProducerService producerService;

    /**
     * @Author zhoufang@si-tech.com.cn
     * @Description   kafka发送消息
     * @Date 2022/2/14
     * @Param
     * @Return
     */
    @RequestMapping("send")
    public String send(@RequestBody Map<String, Object> inMap){
        producerService.sendMessage("kafkatest", JSON.toJSONString(inMap));
        return "000000";
    }

}
